<template>
    <div class="main">
        <navTop></navTop>
        <div class="cont">
            <div class="top">
                <div class="info">
                    <div class="title">
                        <span class="ug" v-if="info.is_rush">急</span>
                        <span class="name">{{ info.name }}</span>
                    </div>
                    <div class="type">
                        <span>{{ info.dept_name }}</span>|
                        <span>{{ info.cate_name }}</span>
                    </div>
                    <div class="state">
                        <span>{{ info.place_name }}</span>
                        <el-button type="info" @click="open" class="sq">申请职位</el-button>
                    </div>

                </div>
                <div class="descr">
                    <div class="title">
                        <span>职位描述</span>
                        <span class="line"></span>
                    </div>
                    <div class="vhtml" v-html="info.intro"></div>
                </div>
                <div class="descr">
                    <div class="title">
                        <span>公司信息</span>
                        <span class="line"></span>
                    </div>
                    <div class="comptle">
                        <img :src="options.zp_logo" alt="">
                        <div class="right">
                            <p>{{ options.zp_company }}</p>
                            <div class="vhtml" v-html="options.zp_intro"></div>
                        </div>
                    </div>
                </div>
                <div class="btn">
                    <el-button type="info" @click="open" class="sq">申请职位</el-button>
                </div>
                <div class="btn2">
                    <el-button type="info" @click="open2" class="sq">投递简历</el-button>
                </div>
            </div>
        </div>
        <el-dialog :close-on-click-modal="false" :show-close="false" :visible.sync="dialogVisible" width="40%">
            <div slot="title" class="dioTitle">
                <span>
                    隐私政策说明
                </span>
            </div>
            <div class="vhtml" v-html="content"></div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="makeSure">确 定</el-button>
            </span>
        </el-dialog>
        <div class="drawer">
            <el-drawer direction="ttb" :show-close="false" :visible.sync="dialogVisible2" size="100%">
                <div slot="title" class="dioTitle">
                    <span>
                        隐私政策说明
                    </span>
                </div>
                <div class="vhtml" v-html="content"></div>
                <div class="dialog-footer">
                    <el-button @click="dialogVisible2 = false">取 消</el-button>
                    <el-button type="primary" @click="makeSure">确 定</el-button>
                </div>
            </el-drawer>
        </div>
    </div>
</template>

<script>
import navTop from "./components/navTop.vue"

export default {
    components: {
        navTop
    },
    data() {
        return {
            info: {},
            dialogVisible: false,
            dialogVisible2: false,
            content: "",
            id: 0
        }
    },
    mounted() {
        let id = this.$route.query.id
        if (id) {
            this.getInfo(id)
            this.id = parseInt(id)
        }
        this.getXieyi()

    },
    computed: {
        options() {
            return this.$store.state.dataInfo
        },
    },
    methods: {
        getXieyi() {
            this.$api.getArtInfo({
                class_id: 5,
            }).then(res => {
                if (res.code == 1) {
                    this.content = res.data.post_content
                }
            })
        },
        getInfo(id) {
            this.$api.getJobDetail({
                id
            }).then(res => {
                if (res.code == 1) {
                    this.info = res.data
                }
            })
        },
        makeSure() {
            localStorage.setItem('PRIVACY', true)
            this.dialogVisible = false

            this.$router.push({
                path: '/getjob', query: {
                    id: this.id
                }
            })
        },
        open() {
            let PRIVACY = localStorage.getItem('PRIVACY')
            console.log(PRIVACY);
            if (PRIVACY) {

                this.$router.push({
                    path: '/getjob', query: {
                        id: this.id
                    }
                })
            } else {

                this.dialogVisible = true
            }
        },
        open2() {
            let PRIVACY = localStorage.getItem('PRIVACY')
            console.log(PRIVACY);
            if (PRIVACY) {

                this.$router.push({
                    path: '/getjob', query: {
                        id: this.id
                    }
                })
            } else {

                this.dialogVisible2 = true
            }
        }
    },
}
</script>

<style lang="scss" scoped>
.main {
    background: rgba(131, 130, 130, 0.1);

    .cont {
        padding: 20px 350px;
        min-height: calc(100vh - 72px);

        >div {
            background-color: #fff;
        }

        .top {
            margin-top: 15px;
            padding: 30px 40px;

            .info {
                &:last-child {
                    .state {
                        border: none;
                    }
                }

                .title {
                    font-size: 18px;

                    .ug {
                        background-color: #ff6b6b;
                        padding: 3px 5px;
                        color: #fff;
                        font-size: 18px;
                        margin-right: 10px;
                    }

                }

                .type {
                    color: #f3f3f3;

                    >span {
                        color: #b1afaf;

                        padding: 15px;
                        display: inline-block;
                        font-size: 16px;

                        &:first-child {
                            padding-left: 0;
                        }
                    }
                }

                .state {
                    color: #504f4f;
                    display: flex;
                    justify-content: space-between;
                    padding: 0 0 25px;

                    span {
                        font-size: 16px;
                    }

                    .sq {
                        background-color: black;
                        color: #fff;
                        border-radius: 0;
                    }
                }
            }
        }

        .descr {
            margin-bottom: 20px;

            .title {
                display: flex;
                align-items: center;
                font-size: 16px;

                .line {
                    height: 1px;
                    flex: 1;
                    background-color: #ebeaea;
                }
            }



            .vhtml {
                font-size: 15px;
                margin-bottom: 20px;

            }

            .job {
                margin: 30px 0;

                div {
                    color: #b4b2b2;
                    font-size: 15px;
                }

                span {
                    font-size: 16px;
                }
            }

            .comptle {
                margin-top: 20px;
                display: flex;

                img {
                    width: 60px;
                    height: 60px;
                    margin-right: 15px;
                }

                .right {
                    flex: 1;
                    overflow: hidden;
                    // display: flex;
                    align-items: center;
                    justify-content: center;
                    flex-direction: column;

                    p {
                        font-weight: bold;
                        width: 100%;
                        text-align: left;
                        margin: 0;
                        padding: 0;
                        font-size: 16px;
                    }

                    .vhtml {
                        color: #89909e;
                    }
                }
            }
        }
    }
}

.btn {
    .sq {
        background-color: black;
        color: #fff;
        border-radius: 0;
    }

    display: flex;
    justify-content: center;
}

.dioTitle {
    height: 120px;
    font-size: 20px;
    font-weight: 600;
    line-height: 28px;
    color: #fff;
    padding: 0 36px;
    background: -webkit-linear-gradient(289deg, #1cc0fb 0%, #0c8cf6 100%);
    background: linear-gradient(161deg, #1cc0fb 0%, #0c8cf6 100%);

    span {
        display: block;
        padding-top: 33px;
    }
}

::v-deep .el-dialog__header {
    padding: 0;
}

::v-deep .vhtml {

    img {
        max-width: 100%;
    }

    div,
    span,
    p {
        max-width: 100%;
    }
}

.btn2 {
    display: none;
}

@media screen and (max-width:768px) {
    .main {
        .cont {
            padding: 0;

            .top {
                padding-bottom: 90px;

                .info {
                    padding: 10px 10px;

                    .title {
                        font-size: 16px;
                        display: flex;
                        align-items: center;

                        .ug {
                            font-size: 12px;
                            padding: 2px 6px;
                            margin-right: 5px;
                            border-radius: 5px;
                        }
                    }

                    .type {
                        color: #504f4f;
                        margin-top: 15px;
                        font-size: 14px;
                        display: flex;
                        align-items: center;

                        span {
                            font-size: 14px;
                        }
                    }

                    .state {
                        flex-direction: column;
                        padding-bottom: 15px;

                        span {
                            font-size: 14px;

                            &:nth-child(2) {
                                font-size: 12px;
                            }
                        }

                        .sq {
                            display: none;
                        }

                        border-bottom: 5px solid #f3f3f3;
                    }
                }

                .btn {
                    display: none;
                }

                .btn2 {
                    display: flex;
                    position: fixed;
                    bottom: 0;
                    width: 100%;
                    padding: 20px;
                    left: 0;
                    background-color: #fff;

                    button {
                        background-color: black;
                        color: #fff;
                        border-radius: 0;
                        padding: 15px;
                        width: 100%;
                        height: 100%;
                        font-size: 16px;
                    }
                }
            }

            .descr {
                padding: 10px;

                .title {
                    margin-bottom: 9px;
                    font-size: 16px;

                    .line {
                        display: none;
                    }
                }

                .vhtml {

                    ::v-deep span,
                    p,
                    div {
                        color: #a2a4a8;
                        font-size: 14px;
                        white-space: pre-wrap;
                    }
                }

                .comptle {
                    img {
                        height: 48px;
                        width: 48px;
                        margin-right: 10px;
                    }

                    .right {
                        p {
                            margin-bottom: 4px;
                            line-height: 24px;
                            color: #222831;
                            font-size: 16px;
                        }

                        .vhtml {

                            ::v-deep span,
                            div,
                            p {
                                position: relative;
                                line-height: 21px;
                                color: #a2a4a8;
                                font-size: 13px;
                                white-space: pre-wrap;
                            }
                        }
                    }
                }
            }
        }
    }

    .drawer {
        ::v-deep .el-drawer__header {
            padding: 0;
        }

        .dioTitle {
            height: 50px;
            line-height: 50px;
            font-size: 16px;
            white-space: nowrap;
            text-align: center;

            span {
                padding: 0;
            }

          
        }
        ::v-deep .vhtml {
                padding: 0 10px 50px;
                height: calc(100% - 70px);
                overflow-y: auto;
            }
            .dialog-footer{
                padding: 10px;
                display: flex;
                align-items: center;
                height: 70px;
                button{
                    height: 100%;
                    width: 50%;
                    font-size: 16px;
                }
            }
    }

}
</style>